package android.autocode;

import android.autocode.fetchview.FetchView;
import android.autocode.selector.Selector;

public class AutoCode {

	public static void main(String[] args) {
		Cmd[] cmds = { new FetchView(), new Selector() };

		if (args == null || args.length <= 0) {
			System.out.println("error!");

			for (Cmd cmd : cmds) {
				System.out.println(cmd.getHint());
			}

			return;
		}

		for (Cmd cmd : cmds) {
			if (args[0].equals(cmd.getCmd())) {
				String[] subArgs = null;
				if (args.length - 1 > 0) {
					subArgs = new String[args.length - 1];
					System.arraycopy(args, 1, subArgs, 0, args.length - 1);
				}
				cmd.genCode(subArgs);
			}
		}
	}
}
